package loading;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class LoadingServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		
		String name = req.getParameter("name");
		String id = req.getParameter("id");
		
		/*DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
		Entity user = new Entity("User", id);

		user.setProperty("name", name);
		datastore.put(user);*/
		
		HttpSession session = req.getSession();
		
		session.setAttribute("name", name);
		session.setAttribute("id", id);
		
		resp.setContentType("text/plain");
		resp.getWriter().println("Name: " + session.getAttribute("name"));
		resp.getWriter().println("ID: " + session.getAttribute("id"));
	}
}
